package com.wit.action;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.List;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import com.wit.po.Employeeposition;
import com.wit.po.JSONPosition;
import com.wit.service.impl.EmployeePositionserviceImp;

public class PositionAction {
	private String employeePosId;
	private String positionName;
	private String positionDes;
	private String positionOwn;
	private Double firstrate;
	private Double conrate;
	private Double monthrate;
	private Double seasonrate;
	private Double yearrate;
	private Double addEmprate;
	private Double yrateC;
	private Double yrateE;
	private Double grateZ;
	private Double grateE;
	private Double zrate1;
	private Double zrate2;
	private Double zrate3;
	private Double zrate4;
	private Double zrate5;
	private Double areaMrate1;
	private Double areaMrate2;
	private Double areaMrate3;
	private Double areaMrate4;
	private Double firstY;
	private Double secondY;
	private Double areaY;
	private Double areaSrate1;
	private Double areaSrate2;
	private EmployeePositionserviceImp EmPoservice;
	public String getEmployeePosId() {
		return employeePosId;
	}
	public void setEmployeePosId(String employeePosId) {
		this.employeePosId = employeePosId;
	}
	public String getPositionName() {
		return positionName;
	}
	public void setPositionName(String positionName) {
		this.positionName = positionName;
	}
	public String getPositionDes() {
		return positionDes;
	}
	public void setPositionDes(String positionDes) {
		this.positionDes = positionDes;
	}
	public String getPositionOwn() {
		return positionOwn;
	}
	public void setPositionOwn(String positionOwn) {
		this.positionOwn = positionOwn;
	}
	public Double getFirstrate() {
		return firstrate;
	}
	public void setFirstrate(Double firstrate) {
		this.firstrate = firstrate;
	}
	public Double getConrate() {
		return conrate;
	}
	public void setConrate(Double conrate) {
		this.conrate = conrate;
	}
	public Double getMonthrate() {
		return monthrate;
	}
	public void setMonthrate(Double monthrate) {
		this.monthrate = monthrate;
	}
	public Double getSeasonrate() {
		return seasonrate;
	}
	public void setSeasonrate(Double seasonrate) {
		this.seasonrate = seasonrate;
	}
	public Double getYearrate() {
		return yearrate;
	}
	public void setYearrate(Double yearrate) {
		this.yearrate = yearrate;
	}
	public Double getAddEmprate() {
		return addEmprate;
	}
	public void setAddEmprate(Double addEmprate) {
		this.addEmprate = addEmprate;
	}
	public Double getYrateC() {
		return yrateC;
	}
	public void setYrateC(Double yrateC) {
		this.yrateC = yrateC;
	}
	public Double getYrateE() {
		return yrateE;
	}
	public void setYrateE(Double yrateE) {
		this.yrateE = yrateE;
	}
	public Double getGrateZ() {
		return grateZ;
	}
	public void setGrateZ(Double grateZ) {
		this.grateZ = grateZ;
	}
	public Double getGrateE() {
		return grateE;
	}
	public void setGrateE(Double grateE) {
		this.grateE = grateE;
	}
	public Double getZrate1() {
		return zrate1;
	}
	public void setZrate1(Double zrate1) {
		this.zrate1 = zrate1;
	}
	public Double getZrate2() {
		return zrate2;
	}
	public void setZrate2(Double zrate2) {
		this.zrate2 = zrate2;
	}
	public Double getZrate3() {
		return zrate3;
	}
	public void setZrate3(Double zrate3) {
		this.zrate3 = zrate3;
	}
	public Double getZrate4() {
		return zrate4;
	}
	public void setZrate4(Double zrate4) {
		this.zrate4 = zrate4;
	}
	public Double getZrate5() {
		return zrate5;
	}
	public void setZrate5(Double zrate5) {
		this.zrate5 = zrate5;
	}
	public Double getAreaMrate1() {
		return areaMrate1;
	}
	public void setAreaMrate1(Double areaMrate1) {
		this.areaMrate1 = areaMrate1;
	}
	public Double getAreaMrate2() {
		return areaMrate2;
	}
	public void setAreaMrate2(Double areaMrate2) {
		this.areaMrate2 = areaMrate2;
	}
	public Double getAreaMrate3() {
		return areaMrate3;
	}
	public void setAreaMrate3(Double areaMrate3) {
		this.areaMrate3 = areaMrate3;
	}
	public Double getAreaMrate4() {
		return areaMrate4;
	}
	public void setAreaMrate4(Double areaMrate4) {
		this.areaMrate4 = areaMrate4;
	}
	public Double getFirstY() {
		return firstY;
	}
	public void setFirstY(Double firstY) {
		this.firstY = firstY;
	}
	public Double getSecondY() {
		return secondY;
	}
	public void setSecondY(Double secondY) {
		this.secondY = secondY;
	}
	public Double getAreaY() {
		return areaY;
	}
	public void setAreaY(Double areaY) {
		this.areaY = areaY;
	}
	public Double getAreaSrate1() {
		return areaSrate1;
	}
	public void setAreaSrate1(Double areaSrate1) {
		this.areaSrate1 = areaSrate1;
	}
	public Double getAreaSrate2() {
		return areaSrate2;
	}
	public void setAreaSrate2(Double areaSrate2) {
		this.areaSrate2 = areaSrate2;
	}
	
	public String AddPosition() throws IOException
	{
		String positionName1=new String(this.positionName.getBytes("GBK"), "UTF-8");
		String positionDes1=new String(this.positionDes.getBytes("GBK"), "UTF-8");
		String positionOwn1=new String(this.positionOwn.getBytes("GBK"), "UTF-8");
		System.out.println(positionName);
		System.out.println(positionDes);
		System.out.println(positionOwn);

		EmPoservice=new EmployeePositionserviceImp();
		EmPoservice.AddPosition(employeePosId, positionName, positionDes, positionOwn, firstrate, conrate, monthrate, seasonrate, yearrate, addEmprate, yrateC, yrateE, grateZ, grateE, zrate1, zrate2, zrate3, zrate4, zrate5, areaMrate1, areaMrate2, areaMrate3, areaMrate4, firstY, secondY, areaY, areaSrate1, areaSrate2);
		return "success";
	}
	private JSONObject position;
	public JSONObject getPosition() {
		return position;
	}
	public void setPosition(JSONObject position) {
		this.position = position;
	}
	public String ReturnPosition() throws IOException
	{
		positionName=new String(positionName.getBytes("GBK"), "UTF-8");
		EmPoservice=new EmployeePositionserviceImp();
		JSONPosition emp=EmPoservice.ReturnPostion(positionName);
		JSONObject jso=JSONObject.fromObject(emp);
		position=jso;
		return "success";
	}
	public String MendPosition() throws IOException
	{
		positionName=new String(positionName.getBytes("GBK"), "UTF-8");
		positionDes=new String(positionDes.getBytes("GBK"), "UTF-8");
		positionOwn=new String(positionOwn.getBytes("GBK"), "UTF-8");
		EmPoservice=new EmployeePositionserviceImp();
		EmPoservice.mendPosition(employeePosId, positionName, positionDes, positionOwn, firstrate, conrate, monthrate, seasonrate, yearrate, addEmprate, yrateC, yrateE, grateZ, grateE, zrate1, zrate2, zrate3, zrate4, zrate5, areaMrate1, areaMrate2, areaMrate3, areaMrate4, firstY, secondY, areaY, areaSrate1, areaSrate2);
		return "success";
	}
	public String DelPosition()
	{
		EmPoservice=new EmployeePositionserviceImp();
		EmPoservice.DelPosition(employeePosId);
		return "success";
	}
	private JSONArray returnlist;
	
	public JSONArray getReturnlist() {
		return returnlist;
	}
	public void setReturnlist(JSONArray returnlist) {
		this.returnlist = returnlist;
	}
	public String Exitposition()
	{
		EmPoservice=new EmployeePositionserviceImp();
		List<Employeeposition> list=EmPoservice.ExistPosition();
		JSONArray jsa=JSONArray.fromObject(list);
		returnlist=jsa;
		return "success";
	}
	
}
